//公共接口
import request from '../utils/request.js'


// 获取地区列表
export function getAddressInfo() {
  return request({
    url: '/api/address/list',
    method: 'POST'
  })
}


// 获取配置信息
export function getSettingInfo() {
  return request({
    url: '/api/auth/setting',
    method: 'POST'
  })
}


// 获取联系电话号码
export function getPhoneInfo() {
  return request({
    url: '/api/auth/phone/list',
    method: 'POST'
  })
}
//文章详情
export function articleDetail(id) {
  return request({
    url: '/api/auth/article/'+id,
    method: 'POST'
  })
}

//文件上传
export function uploadFile(file, fileName = 'file', success, fail) {
  return wx.uploadFile({
    url: getApp().globalData.BASE_URL + '/api/upload',
    filePath: file,
    name: fileName,
    success: function (res) {
      success(res)
    }, fail: err => {
      fail(err)
    }
  });
}
